#pragma once

#include <iostream>
#include <string>
#include "util.hpp"

namespace ns_log
{
    using namespace ns_util;

    enum
    {
        INFO,
        DEBUG,
        WARRING,
        ERROR,
        FATAL
    };

    inline std::ostream &Log(const std::string &level, const std::string &filename, int line)
    {
        std::string message = "[";
        message += level;
        message += "]";

        message += "[";
        message += filename;
        message += "]";

        message += "[";
        message += std::to_string(line);
        message += "]";

        message += "[";
        message += TimeUtil::GetTimeStamp();
        message += "]";

        std::cout << message; // 不加endl刷新

        return std::cout;
    }

// LOG(DEBUG)<<"*********"<<endl;
// 开放型日志
#define LOG(level) Log(#level, __FILE__, __LINE__)
}